// Example 9-6. The QMoviePlayer object header file QMoviePlayer.hpp
//
#include <QWidget>
#include <opencv2/opencv.hpp>
#include <string>
using namespace std;

class QMoviePlayer : public QWidget {
  Q_OBJECT;

public:
  explicit QMoviePlayer(QWidget *parent = NULL);
  ~QMoviePlayer() override = default;
  bool open(string file);

protected:
  void paintEvent(QPaintEvent *event) override;

private:
  cv::VideoCapture m_cap;
  QImage m_qt_img;
  cv::Mat m_cv_img;
  QTimer *m_timer;
  void _copyImage(void);
public slots:
  void nextFrame();
};
